package com.huawei.gamebox.service.welfare.campaign.node;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import com.huawei.appgallery.foundation.ui.framework.widget.Space;
import com.huawei.gamebox.service.welfare.campaign.card.BaseCampaignCard;
import o.azb;
import o.cih;
import o.exp$a;
import o.exp.d;
import o.exp.j;
import o.fbs;

public class CampaignFlatNode extends BaseCampaignNode {
    public CampaignFlatNode(Context context) {
        super(context);
    }

    public int ˏ() {
        if (this.ॱ.getResources().getConfiguration().orientation == 2) {
            return 3;
        }
        return 2;
    }

    protected int ˎ() {
        return j.ॱʻ;
    }

    protected BaseCampaignCard ˋ(boolean z) {
        return new fbs(this.ॱ, z);
    }

    public boolean ˊ(ViewGroup viewGroup, ViewGroup viewGroup2) {
        LayoutInflater from = LayoutInflater.from(this.ॱ);
        View inflate = from.inflate(j.ᐝᐝ, null);
        LinearLayout linearLayout = (LinearLayout) inflate.findViewById(d.ॱꓸ);
        linearLayout.setPadding(azb.ˊ(this.ॱ), 0, azb.ˏ(this.ॱ), 0);
        LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
        layoutParams.weight = 1.0f;
        int ˏ = ˏ();
        LayoutParams layoutParams2 = new LinearLayout.LayoutParams(ʼ(), -1);
        for (int i = 0; i < ˏ; i++) {
            if (i != 0) {
                linearLayout.addView(new Space(this.ॱ), layoutParams2);
            }
            View inflate2 = from.inflate(j.ॱʻ, null);
            cih o_fbs = new fbs(this.ॱ, false);
            o_fbs.ˊ(ˏ);
            o_fbs.ˏ(inflate2);
            ˊ(o_fbs);
            linearLayout.addView(inflate2, layoutParams);
        }
        viewGroup.addView(inflate);
        return true;
    }

    protected int ʼ() {
        return this.ॱ.getResources().getDimensionPixelSize(exp$a.ʽॱ);
    }
}
